home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / snz128s / src / snews.h < prev    next >
C/C++ Source or Header  |  1994-05-23  |  9KB  |  248 lines

  1. /*
  2.     SNEWS 2.0
  3.  
  4.     Private decls the SNEWS news reader
  5.  
  6.  
  7.     Copyright (C) 1991  John McCombs, Christchurch, NEW ZEALAND
  8.                         john@ahuriri.gen.nz
  9.                         PO Box 2708, Christchurch, NEW ZEALAND
  10.  
  11.     This program is free software; you can redistribute it and/or modify
  12.     it under the terms of the GNU General Public License, version 1, as
  13.     published by the Free Software Foundation.
  14.  
  15.     This program is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.     GNU General Public License for more details.
  19.  
  20.     See the file COPYING, which contains a copy of the GNU General
  21.     Public License.
  22.  
  23.  */
  24.  
  25. /*---------------------------- Source Control ------------------------------*/
  26.  
  27. /*
  28.  * $Id: SNEWS.H,v 1.2 1994/02/05 18:45:50 gbj Exp user $
  29.  */
  30.  
  31. /****************************************************************************
  32. *   22 May 92   1.2     GT  Enable "INCLUDE_SIG".                           *
  33. *   09 Jun 92   1.3     GT  Right and left cursor keys.                     *
  34. *   26 Jun 92   1.4     GT  Fix length of TEXT->post_date.                  *
  35. *   17 Jul 92   1.5     GT  C++ compilation.                                *
  36. *   16 Aug 92   1.6    MSM  Snews 1.90                                      *
  37. *                           Lock file support                               *
  38. *   31 May 93   1.7    MSM  Snews 2.0                                       *
  39. *   26 Sep 93   1.8    MSM  Snews 1.24                                      *
  40. *    2 Apr 94   1.9    MSM  Snews 1.28                        *
  41. ****************************************************************************/
  42.  
  43. #ifdef __TURBOC__
  44. #    include <alloc.h>
  45. #else
  46. #    ifndef ATARI
  47. #        include <malloc.h>
  48. #    endif
  49. #endif
  50. #include <process.h>
  51. #include <io.h>
  52. #include <ctype.h>
  53.  
  54. #define INCLUDE_SIG         /* enable this to have the reply function put */
  55.                             /* your sig on the reply - mail ususally does */
  56.                             /* this                                       */
  57.  
  58. #define MAXLINE             1024          /* Snews 2.0 */
  59. #define MAXART              256           /* Snews 2.0 */
  60.  
  61. #define ENTER               0x0D
  62. #define ESCAPE              0x1B
  63. #define TAB                 0x09
  64. #define BACKSP              0x08          /* Snews 2.0 */
  65. #define LEFT                0x4b
  66. #define RIGHT               0x4d
  67. #define Fn1                 0x3b
  68. #define Fn2                 0x3c
  69. #define Fn3                 0x3d 
  70.  
  71. #define EX_DONE             1
  72. #define EX_QUIT             2
  73. #define EX_SAVE             3
  74. #define EX_NEXT             4
  75. #define EX_PREV             5
  76. #define EX_NEXT_UNREAD      6
  77. #define EX_ROT13            7
  78. #define EX_DUMMY            8
  79. #define    EX_NOTREAD        128
  80. #define EX_SEARCH_FORW      9              /* Snews 2.0 */
  81. #define EX_SEARCH_BACKW     10              /* Snews 2.0 */
  82. #define EX_PREVIOUS         11            /* Snews 2.0 */
  83. #define EX_FIRST        12
  84. #define EX_LAST             13
  85. #define TEXT_LINE           5
  86.  
  87.  
  88. #define PAGE_HEADER         4
  89. #define PAGE_LENGTH         (scr_rows - 6)
  90. #define PAGE_SIZE           (scr_rows)    /* Snews 2.0 */
  91.  
  92. /* if you change these see show_help */
  93. #define HELP_GROUP          0
  94. #define HELP_THREAD         1
  95. #define HELP_ARTICLES       2
  96.  
  97. #define  UP_ARR             'H'
  98. #define  DN_ARR             'P'
  99. #define  LT_ARR             'K'
  100. #define  RT_ARR             'M'
  101. #define  C_L_ARR            's'              /* Snews 2.0 */
  102. #define  C_R_ARR            't'              /* Snews 2.0 */
  103. #define  C_UP_ARR           0x8D          /* Snews 2.0 */
  104. #define  C_DN_ARR           0x91          /* Snews 2.0 */
  105. #define  PGUP               'I'
  106. #define  PGDN               'Q'
  107. #define  HOME               'G'
  108. #define  END                'O'
  109. #define  CTRLP              0x10          /* Snews 2.0 */
  110.  
  111.  
  112.  
  113. /*
  114.  *  This structure allows the creation of linked list of article numbers
  115.  */
  116. typedef struct art_id {
  117.     long   id;                  /* article number                 */
  118.     long   art_off;             /* offset of the article          */
  119.     struct art_id *next_art;    /* pointer to next article number */
  120.     struct art_id *prev_art;    /* pointer to last article number */
  121. } ART_ID;
  122.  
  123. /*
  124.  *  This structure is a doubly linked list of the unique article headers.  The
  125.  *  linked list of article numbers is built on 'art_num'.  This system
  126.  *  is allows flexible use of memory, but will get slower by n'ish
  127.  *  and there is a fair degree of allocation overhead in the ART_ID structure
  128.  *  But hey, it's simple
  129.  */
  130. typedef struct article {
  131.     char   header[60];          /* article header              */
  132.     int    num_articles;        /* number with this header     */
  133.     ART_ID *art_num;            /* pointer to list of articles */
  134.     struct article *next;       /* next topic                  */
  135.     struct article *last;       /* last topic                  */
  136.     int    index;               /* topic number from start     */
  137.     struct article *left;       /* for tree structure          */
  138.     struct article *right;
  139. } ARTICLE;
  140.  
  141.  
  142. /*
  143.  *  This structure is the handle for an article in ram.  The file
  144.  *  is read in and the linked list built.
  145.  */
  146. typedef struct {
  147.     char  *author;            /* truncated author                        */
  148.     char  *organisation;      /* truncated organisation                  */
  149.     char  post_date[48];      /* date of posting                   NJL   */
  150.     char  *follow_up;         /* group for follow-up article             */
  151.     char  *subject;           /* Article Subject                         */
  152.     char  *newsgroup;         /* The newsgroup of the article            */
  153.     char  *distribution;      /* The article distribution                */
  154.     char  *references;        /* The references header line              */
  155.     int   lines;              /* total lines in file                     */
  156.     LINES  *top;              /* points to start of article, incl header */
  157.     LINES  *start;            /* points to start of text                 */
  158. } TEXT;
  159.  
  160. /*
  161.  * This structure holds the list of messages to be sent via SMTP
  162.  * when mail is sent (or an article is posted via mail)
  163.  */
  164.  
  165. typedef struct wrk_file {
  166.     char next_site[80];        /* Next site to contact                   */
  167.     char from[80];             /* Message is from                        */
  168.     char to[80];               /* Mail addressed to                      */
  169.     long seq;                  /* sequence No. for this item             */
  170.     struct wrk_file *next;       /* Points to next entry                   */
  171. } WRK_FILE;
  172.  
  173.  
  174.  
  175. ACTIVE *select_group(ACTIVE *head, ACTIVE *current);
  176. void show_help(int h);
  177. void show_values(void);
  178. void change_values(void);
  179. int read_group(ACTIVE *gp);
  180. void show_groups(ACTIVE **top, ACTIVE *this_group, int force, ACTIVE *head);
  181. ARTICLE *get_headers(ACTIVE *gp);
  182. void eat_gunk(char *buf);
  183. void free_header(ARTICLE *start);
  184.  
  185.  
  186. void show_threads(ACTIVE *gp, ARTICLE **top, ARTICLE *this_thread, int force, ARTICLE *head);
  187. int select_thread(ACTIVE *gp, ARTICLE *head);
  188. ARTICLE *search_thread(ACTIVE *gp, ARTICLE *head, int search_body, int direction);
  189. ACTIVE *search_for_group(ACTIVE *group, int direction);
  190. int read_thread(ACTIVE *gp, ARTICLE *this_thread, ART_ID *first, int a_ct);
  191. int mark_thread_as_read(ACTIVE *gp, ARTICLE *this_thread, int ask);
  192. void mark_thread_as_unread(ACTIVE *gp, ARTICLE *this_thread);
  193. int smartcmp(char *str1, char *str2);
  194. int strip_off_part(char *str);
  195. char *skip_vi(char *str);
  196.  
  197. int count_unread_in_thread(ACTIVE *gp, ARTICLE *a);
  198. int count_unread_in_group(ACTIVE *gp);
  199. int  mark_group_as_read(ACTIVE *gp, int ask);
  200. void mark_group_as_unread(ACTIVE *gp);
  201.  
  202. void command(char *msg);
  203. void message(char *msg);
  204. void lmessage(char *msg);
  205.  
  206. TEXT *load_article(char *fnx, long offset, int warn);
  207. void free_article(TEXT *t);
  208.  
  209.  
  210. int read_article(ACTIVE *gp, TEXT *tx, ARTICLE *this_article, int a_ct, ART_ID *id);
  211. void show_article(ACTIVE *gp, TEXT *tx, char *subject, LINES *this_line, int a_ct,
  212.                   int of_ct);
  213.  
  214.  
  215. void save_to_disk(ACTIVE *gp, long offset);
  216. void print_article(ACTIVE *gp, long offset);
  217. void print_thread(ACTIVE *gp, ARTICLE *art);
  218. void reply_to_article(TEXT *tx, char *subject);
  219. void get_his_stuff(TEXT *tx, char *author, char *msg_id, char *r_name);
  220. void ReplyAddress(TEXT *tx, char *subject);
  221.  
  222. WRK_FILE *parse(char *name, int ismail);
  223.  
  224. int post(TEXT *tx, char *newsgroups, char *subject);
  225. int post_header(TEXT *tx, FILE *article, char *newsgroups, char *subject, char *msg_id, int lct);
  226. int post_it(char *article, char *newsgroups);
  227.  
  228. void rot13(TEXT *tx);
  229.  
  230. void expand_tabs(char *buf, int max_len);
  231.  
  232. int newsgroups_valid(char *ng);
  233.  
  234. void mail_to_someone(TEXT *tx);
  235. void free_wrk(WRK_FILE *wrk);
  236. void pass_to_smtp(char *name, WRK_FILE *wrk, int ismail);
  237.  
  238. void save_group_to_disk(ACTIVE *gp);
  239. void save_thread_to_disk(ACTIVE *gp, ARTICLE *this_thread);
  240.  
  241. int make_header(FILE *tmp, char *subject, char *author, char *cc, char *bc, int *lct);
  242.  
  243. void bug_report(void);
  244.  
  245. extern char *dow[];
  246. extern char *mth[];
  247.  
  248.